package com.dms.modules.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dms.modules.admin.entity.AdminCommentReport;
import com.dms.modules.admin.vo.AdminCommentReportVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AdminCommentReportMapper extends BaseMapper<AdminCommentReport> {
    
    @Select("SELECT r.*, u.username as userName " +
            "FROM admin_comment_report r " +
            "LEFT JOIN user u ON r.user_id = u.id " +
            "ORDER BY r.create_time DESC")
    IPage<AdminCommentReportVO> selectCommentReports(Page<AdminCommentReportVO> page);
    
    @Update("UPDATE admin_comment_report " +
            "SET status = #{status}, " +
            "handle_result = #{handleResult}, " +
            "remark = #{remark}, " +
            "handle_time = NOW() " +
            "WHERE id = #{reportId}")
    int updateReportStatus(@Param("reportId") Long reportId, 
                          @Param("status") Integer status,
                          @Param("handleResult") String handleResult, 
                          @Param("remark") String remark);
} 